body {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    background-color: #f0f8ff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    color: #333;
    overflow: hidden;
}

#game-container {
    text-align: center;
    position: relative;
    border: 5px solid #333;
    background-color: #fff;
    padding: 20px;
    padding-top: 60px; /* Make space for top UI */
    border-radius: 15px;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
}

canvas {
    border: 2px solid #000;
    cursor: pointer;
    background-color: #f0f8ff; /* Default background if image fails */
    background-image: url('road_background.png');
    background-size: cover;
    transition: background-image 1s ease-in-out;
}

canvas.persistent-night {
    background-image: url('night_background.png');
}

canvas.night {
    background-image: url('night_background.png');
}

canvas.lava {
    background-image: url('lava_background.png');
}

canvas.ocean {
    background-image: url('ocean_background.png');
}

canvas.farm {
    background-image: url('farm_background.png');
}

canvas.desert {
    background-image: url('desert_background.png');
}

canvas.airstrike {
    background-image: url('airstrike_background.png');
}

canvas.concert {
    background-image: url('concert_background.png');
}

canvas.nuclear {
    background-image: url('nuclear_background.png');
}

canvas.glitch {
    background-color: #111;
}

canvas.nyancat {
    background-image: url('nyan_cat_background.png');
}

canvas.chocolate {
    background-image: url('chocolate_background.png');
}

canvas.space {
    background-image: url('space_background.png');
}

.hidden-asset {
    display: none;
}

#event-timer-container {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid white;
    z-index: 20;
}

#admin-abuse-timer-container {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background-color: rgba(139, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    border: 2px solid #FFD700;
    z-index: 20;
    text-shadow: 1px 1px 2px black;
}

#global-broadcast-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    font-weight: bold;
    color: #FFD700;
    background-color: rgba(0, 0, 0, 0.75);
    padding: 20px;
    border-radius: 15px;
    border: 3px solid #FFD700;
    text-shadow: 2px 2px 4px black;
    z-index: 101;
    text-align: center;
    max-width: 80%;
}

#admin-abuse-timer-container.hidden, #global-broadcast-container.hidden {
    display: none;
}

#event-timer-container.hidden {
    display: none;
}

#ui-container {
    margin-top: 10px;
    font-size: 24px;
    font-weight: bold;
}

#message-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: bold;
    color: gold;
    text-shadow: -2px 0 black, 0 2px black, 2px 0 black, 0 -2px black;
    background-color: rgba(255, 255, 255, 0.5);
    padding: 15px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.5s ease-out;
    pointer-events: none;
    z-index: 100;
}

#top-ui {
    position: absolute;
    top: 10px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 10;
}

#top-right-ui {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

#admin-controls-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#admin-panel-toggle {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    border: 2px solid #ff0000;
    border-radius: 8px;
    background-color: rgba(255, 215, 0, 0.8);
    color: #ff0000;
    text-shadow: 1px 1px 1px white;
    cursor: pointer;
    margin-bottom: 5px;
}

#admin-panel-toggle.hidden {
    display: none;
}

#admin-panel {
    width: 250px;
    max-height: 450px;
    overflow-y: auto;
    background: rgba(25, 25, 25, 0.95);
    border: 2px solid #ff0000;
    border-radius: 8px;
    padding: 10px;
    text-align: left;
    color: white;
}

#admin-panel.hidden {
    display: none;
}

#admin-panel h3, #admin-panel h4 {
    text-align: center;
    color: #ff0000;
    text-shadow: 1px 1px 2px #000;
    margin: 5px 0;
}

#admin-panel h4 {
    margin-top: 15px;
    border-top: 1px solid #ff0000;
    padding-top: 10px;
}

#admin-broadcast {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
}

#global-broadcast-input {
    flex-grow: 1;
    background-color: #333;
    color: white;
    border: 1px solid #ff0000;
    border-radius: 4px;
    padding: 4px;
}

#admin-event-triggers, #admin-luck-controls, #admin-spawn-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

#admin-rarity-spawn-controls {
    width: 100%;
}

#admin-rarity-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
}

#admin-specific-spawn {
    display: flex;
    width: 100%;
    gap: 5px;
    margin-bottom: 5px;
}

#spawn-name-input {
    flex-grow: 1;
    background-color: #333;
    color: white;
    border: 1px solid #999;
    border-radius: 4px;
    padding: 4px;
}

#admin-panel button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 12px;
    padding: 4px 8px;
    background-color: #555;
    color: white;
    border: 1px solid #999;
    border-radius: 4px;
    cursor: pointer;
}

#admin-panel button:hover {
    background-color: #ff0000;
    color: white;
}

#stop-events-button {
    width: 100%;
    margin-top: 10px;
    background-color: #900;
    font-weight: bold;
}

#system-controls {
    display: flex;
    gap: 5px;
}

#system-controls button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 14px;
    padding: 3px 8px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #e0e0e0;
    cursor: pointer;
}

#top-left-ui {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#luck-display {
    margin-top: 8px;
    font-size: 20px;
    font-weight: bold;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid white;
    text-shadow: 1px 1px 2px black;
}

#luck-display.hidden {
    display: none;
}

#notification-area {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start;
}

.notification {
    background-color: rgba(0, 0, 0, 0.6);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px black;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.unknown-notification {
    font-size: 20px;
    padding: 10px 15px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(255, 215, 0, 1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
}

#money-container {
    font-size: 24px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 5px 10px;
    border-radius: 8px;
    border: 2px solid #333;
}

#fusion-container, #brainrot-index-container, #ritual-container, #feed-me-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#fusion-toggle, #brainrot-index-toggle, #ritual-toggle, #feed-me-toggle {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 18px;
    font-weight: bold;
    padding: 5px 10px;
    border: 2px solid #333;
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    margin-bottom: 5px;
}

#ritual-toggle {
    border: 2px solid #00ffff;
    background-color: rgba(148, 0, 211, 0.7); /* darkviolet with alpha */
    color: white;
    text-shadow: 1px 1px 2px black;
}

#feed-me-toggle {
    border: 2px solid #8B4513; /* SaddleBrown */
    background-color: rgba(210, 105, 30, 0.8); /* Chocolate with alpha */
    color: white;
    text-shadow: 1px 1px 2px black;
}

#fusion-panel {
    width: 350px;
    max-height: 500px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    text-align: left;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#fusion-panel.hidden, #brainrot-index.hidden, #ritual-panel.hidden, #feed-me-panel.hidden, #admin-panel.hidden {
    display: none;
}

#fusion-panel h3, #fusion-panel h4 {
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 18px;
}

#fusion-panel h4 {
    font-size: 14px;
    margin-top: 15px;
    border-top: 1px solid #ccc;
    padding-top: 10px;
}

#fusion-slots-container {
    display: flex;
    justify-content: space-around;
    padding: 10px;
    background-color: #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    min-height: 60px;
}

.fusion-slot {
    width: 50px;
    height: 50px;
    border: 2px dashed #999;
    border-radius: 5px;
    background-color: #f0f0f0;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}
.fusion-slot.filled {
    border-style: solid;
}

#fusion-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

#fuse-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#fuse-button img {
    width: 20px;
    height: 20px;
}

#fusion-controls button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 16px;
    padding: 5px 15px;
    cursor: pointer;
}

#fusion-controls button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

#fusion-outcomes {
    background-color: #f9f9f9;
    padding: 8px;
    border-radius: 5px;
    min-height: 60px;
}

#outcomes-list {
    font-size: 13px;
    text-align: center;
}

#inventory-list {
    font-size: 12px;
    font-weight: normal;
    max-height: 150px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 5px;
}

.inventory-item {
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-size: 11px;
}

.inventory-item:hover {
    background-color: #e0e0e0;
}

.inventory-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

.fusion-recipe {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.fusion-recipe p {
    margin: 0 0 5px 0;
    font-weight: bold;
}

.fusion-recipe button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 14px;
    padding: 3px 8px;
    cursor: pointer;
}

.fusion-recipe button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#ritual-panel {
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    text-align: left;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#ritual-panel h3 {
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 18px;
    color: #4B0082; /* Indigo */
}

.ritual-recipe {
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #999;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.ritual-recipe p {
    margin: 0 0 5px 0;
    font-size: 13px;
    font-weight: normal;
}

.ritual-recipe .ingredients-list {
    font-size: 13px;
    margin-left: 15px;
    font-style: italic;
}

.ingredients-list .ritual-count {
    font-weight: bold;
    color: #555;
    font-size: 12px;
}

.ritual-recipe button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 14px;
    padding: 3px 8px;
    cursor: pointer;
    width: 100%;
    margin-top: 5px;
}

.ritual-recipe button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ritual-recipe-complete {
    padding: 8px;
    text-align: center;
    background-color: #e8f5e9; /* Light green */
    border: 1px solid #4caf50; /* Green */
    border-radius: 5px;
    color: #1b5e20; /* Dark green */
}

.ritual-recipe-complete p {
    margin: 0;
}

.ritual-recipe-complete span {
    font-size: 12px;
}

#feed-me-panel {
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #8B4513;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#feed-me-panel h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #8B4513;
}

#feed-me-progress p {
    font-size: 16px;
    margin: 10px 0;
}

#feed-me-counter {
    font-weight: bold;
    font-size: 18px;
}

#feed-me-button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 16px;
    padding: 5px 10px;
    cursor: pointer;
    width: 100%;
    margin: 10px 0;
    background-color: #D2691E; /* Chocolate */
    color: white;
    border: 2px solid #8B4513;
    border-radius: 6px;
}

#feed-me-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    background-color: #a0522d; /* Sienna */
}

#feed-me-rewards {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #8B4513;
}

#feed-me-rewards h4 {
    font-size: 14px;
    margin: 0 0 5px 0;
}

#feed-me-rewards p {
    font-size: 13px;
    margin: 2px 0;
}

#brainrot-index {
    width: 300px; /* Increased width for tabs */
    max-height: 400px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #333;
    border-radius: 8px;
    padding: 10px;
    text-align: left;
    display: flex; /* Use flexbox for layout */
    flex-direction: column;
}

#brainrot-index.no-brainrot-collection {
    border: 2px solid black !important;
}

#brainrot-index h3 {
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 18px;
}

#index-tabs {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 2px solid #ccc;
}

.index-tab-button {
    flex-grow: 1;
    padding: 5px;
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 12px;
    border: 1px solid #ccc;
    border-bottom: none;
    background-color: #f0f0f0;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    margin-bottom: -2px;
    font-weight: bold;
}

.index-tab-button.active {
    background-color: white;
    border-bottom: 2px solid white;
    color: #333;
}

.index-tab-button[data-variant="gold"].active { color: #ffd700; text-shadow: 1px 1px 1px #000; }
.index-tab-button[data-variant="diamond"].active { color: #b9f2ff; text-shadow: 1px 1px 1px #000; }
.index-tab-button[data-variant="rainbow"].active {
    background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet);
    color: white;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    font-weight: bold;
}

#index-content {
    overflow-y: auto;
    flex-grow: 1; /* Allow content to fill remaining space */
}

.index-rarity-header {
    margin: 10px 0 5px 0;
    font-size: 16px;
    font-weight: bold;
    padding-bottom: 3px;
    border-bottom: 1px solid #ccc;
    text-shadow: 1px 1px 1px #000;
}

.index-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    margin-bottom: 3px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-size: 12px;
}

.index-item.not-collected {
    border: 2px solid black;
    background-color: #f5f5f5;
}

.index-item-name {
    font-weight: bold;
}

.index-item-name.not-collected {
    color: #999;
    font-style: italic;
}

.index-item-details {
    color: #555;
    font-size: 11px;
}

/* Rarity-specific coloring */
.rarity-common { color: gray; }
.rarity-rare { color: blue; }
.rarity-epic { color: purple; }
.rarity-legendary { color: orange; }
.rarity-mythic { color: magenta; }
.rarity-godly { color: gold; }
.rarity-secret { color: teal; }
.rarity-unknown { color: darkgray; }
.rarity-admin { color: crimson; }

#index-content p {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: bold;
    transition: color 0.3s ease;
}

#password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

#password-modal.hidden {
    display: none;
}

.modal-content {
    background-color: white;
    padding: 25px;
    border-radius: 15px;
    border: 5px solid #333;
    box-shadow: 10px 10px 0px rgba(0,0,0,0.2);
    text-align: center;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content input {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
    border: 2px solid #333;
    margin: 10px 0;
    width: 90%;
}

.modal-content button {
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 18px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 2px solid #333;
    background-color: #e0e0e0;
    cursor: pointer;
}

.modal-content .error {
    color: red;
    font-weight: bold;
    margin-top: 10px;
}

.modal-content .error.hidden {
    display: none;
}

#skip-loading-button {
    margin-top: 20px;
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 16px;
    padding: 8px 20px;
    border: 2px solid #333;
    border-radius: 8px;
    background-color: #f0f0f0;
    cursor: pointer;
}

#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #f0f8ff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity 0.5s ease-out 0.2s, visibility 0.5s ease-out 0.2s;
    visibility: visible;
    opacity: 1;
}

#loading-screen.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#loading-content {
    text-align: center;
}

#loading-brainrot-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin-bottom: 20px;
    animation: bounce 2s infinite ease-in-out;
}

#loading-content h2 {
    font-size: 2em;
    color: #333;
}

#loading-bar-container {
    width: 300px;
    height: 20px;
    border: 2px solid #333;
    border-radius: 10px;
    margin-top: 20px;
    background-color: #fff;
    overflow: hidden;
}

#loading-bar {
    width: 0;
    height: 100%;
    background-color: #4169e1; /* royalblue */
    border-radius: 8px;
    animation: fill-bar 20s linear forwards;
}

@keyframes fill-bar {
    from { width: 0%; }
    to { width: 100%; }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
}

#status-indicator-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
    pointer-events: none; /* Allows clicking through the container */
}

.status-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    position: relative;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px black;
}

.status-icon img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.status-icon .luck-text {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background-color: #ffd700;
    color: black;
    border-radius: 50%;
    padding: 1px 4px;
    font-size: 12px;
    border: 1px solid black;
}

#lucky-wheel-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 500;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#lucky-wheel-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

#lucky-wheel-container {
    position: relative;
    text-align: center;
}

#lucky-wheel-container h3 {
    color: white;
    font-size: 28px;
    text-shadow: 2px 2px 4px black;
    margin-bottom: 10px;
}

#lucky-wheel-canvas {
    border: 5px solid gold;
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

#wheel-pointer {
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 30px solid red;
    filter: drop-shadow(0px 2px 2px rgba(0, 0, 0, 0.5));
}

#skip-spin-button {
    margin-top: 15px;
    font-family: 'Comic Sans MS', 'Chalkduster', 'cursive';
    font-size: 18px;
    padding: 8px 16px;
    border: 2px solid gold;
    border-radius: 8px;
    background-color: rgba(0, 0, 0, 0.7);
    color: gold;
    cursor: pointer;
}

#skip-spin-button:hover {
    background-color: gold;
    color: black;
}